package com.gujiangbo.jvm;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class ListTest {

    public static void main(String[] args) {
        ArrayList<String> arrayList = new ArrayList<>(100010);
        //118651542
        //80248792
        LinkedList<String> linkedList = new LinkedList<>();//101050042
        long start = System.nanoTime();
        for (int i = 0; i < 10; i++) {
            linkedList.add("i=" + i);

        }
        long end = System.nanoTime();

        System.out.println(end - start);

        for (int i = 0; i < 10; i++) {
            System.out.println(linkedList.get(i));
        }

        List<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            if (i % 2 == 0)
                list.add("zhangsan");
            else
                list.add("lisi");
        }

        list.stream().distinct().forEach(System.out::println);
    }
}
